package housekeeping.controller;

import housekeeping.pojo.UserAccounts;
import housekeeping.service.UserAccountsService;
import housekeeping.util.ServerResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @version 1.0
 * @Author Du
 * @Date 2025/7/7 14:59
 * @注释
 */
@RestController
@CrossOrigin
@Tag(name="账号管理")
public class UserController {

    @Autowired
    private UserAccountsService userAccountsService;

    @GetMapping("/user/list")
    @Operation(summary = "显示所有用户账号")
    public ServerResult<List<UserAccounts>> getUserAccounts() {
        List<UserAccounts> list = userAccountsService.getUserAccounts();
        return ServerResult.ok(list);
    }

    @DeleteMapping("/user/delete/{id}")
    @Operation(summary = "删除用户账号")
    private ServerResult<Void> deleteUserAccounts(@PathVariable("id") Integer id){
        userAccountsService.deleteUserAccounts(id);
        return ServerResult.ok();
    }








}
